<#assign module="workcar"/>

<@override name="header">
</@override>
<@override name="body">

	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					填写工作车信息
			    </div>
			    <div class="panel-body">
    				<form id="submit_form" action="${ctx}/workcar/update" class="form-horizontal" method="post">
		                <input type="hidden" name="id" value="${workCar.id}">
		                <input type="hidden" name="status" value="${workCar.status}">
		                <@shiro.isMainCompany>
        				<div class="form-group">
        				   <label class="col-sm-3 control-label"><em>*</em>所属公司：</label>
        				   <div class="col-sm-3">
								<select class="form-control" name="companyId" id="companyId">
									<option value="">--请选择所属公司--</option>
			  						<#list companys as c>
			  						<option value="${c.id}" <#if workCar.companyId?? && workCar.companyId==c.id>selected="selected"</#if>>${c.abbreviation}</option>
			  						</#list>
		  						</select>
	  					    </div>	
	    				</div>
					</@shiro.isMainCompany>	
					 <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>工作车名字：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="workCarName" name="workCarName" type="text" value="${workCar.workCarName?if_exists}" required/>
		                    </div>
		                </div>
		                 <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>费用：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="fixedMoney" name="fixedMoney" type="text" value="${workCar.fixedMoney?if_exists}" required/>
		                    </div>
		                </div>
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>车牌号：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="plateNumber" name="plateNumber" type="text" value="${workCar.plateNumber?if_exists}" required/>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>车型：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="carType" name="carType" type="text" value="${workCar.carType?if_exists}" required/>
		                    </div>
		                </div>
		                 <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>座位数：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="seating" name="seating" type="text" value="${workCar.seating?if_exists}" required/>
		                    </div>
		                </div>
		                <div class="form-group">
		                    <label class="col-sm-3 control-label">工作路线：</label>
		                    <div class="col-sm-3">
		                    	<select class="form-control" id="areaId" name="areaId">
		                    		<option value="">--请选择路线--</option>
		                    		<#if areas??>
			                    		<#list areas as area>
			                    			<option value="${area.id}" <#if workCar.workCarAreaId?? && workCar.workCarAreaId==area.id>selected="selected"</#if>>${area.city?if_exists}-${area.name?if_exists}</option>
			                    		</#list>
		                    		</#if>
		                    	</select>
	                    	</div>
		                </div>
		                
		              	<div class="form-group">
		                    <label class="col-sm-3 control-label">备注：</label>
		                    <div class="col-sm-3">
		                    	<textarea class="form-control" cols="20" id="memo" name="memo" rows="2">${workCar.memo?if_exists}</textarea>
		                	</div>
		                </div>
		                
		                <div class="form-group" style="margin-left:10px;">
			                <label class="col-sm-3 control-label"></label>
			                <input type="submit" id="submit" class="btn btn-primary" value="保存">
			                <input type="button" class="btn btn-default" onclick="window.location.href = '${ctx}/workcar/list';" value="返回">
			            </div>
					</form>
        		</div>
			</div>
		</div>
	</div>

</@override>
<@override name="footer">
<script type="text/javascript">
	<#if message??>
		$.scojs_message("${message}", $.scojs_message.TYPE_ERROR);
	</#if>
	$(document).ready(function(){
		$("#submit").click(function(){
		  if($("#companyId").val()==""){
		    $.scojs_message("请选择所属公司", $.scojs_message.TYPE_ERROR);
		     return false;
		  }
		  
		});
	});
</script>
</@override>
<@extends name="../layout.ftl"/>